<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>住宿添加</title>
    <%@ include file="include/head.jsp" %>
</head>
<body>
<div class="container-fluid">
    <ul class="nav nav-tabs">
        <li><a href="LodgingServlet?action=list">住宿列表</a></li>
        <li class="active"><a href="#">添加</a></li>
    </ul>
    <br/>
    <form class="form-horizontal" role="form" action="LodgingServlet?action=add" method="post" onsubmit="return check()">
        <div class="form-group">
            <label class="col-sm-3 control-label">姓名：</label>
            <div class="col-sm-5">
                <input type="text" class="form-control" id="lodgingName" name="lodgingName">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">性别：</label>
            <div class="col-sm-5">
                <input name="lodgingSex" type="radio" value="男" checked="checked"/>&nbsp;&nbsp;&nbsp;男&nbsp;&nbsp;&nbsp;&nbsp;
                <input name="lodgingSex" type="radio" value="女"/>&nbsp;&nbsp;&nbsp;女&nbsp;&nbsp;&nbsp;&nbsp;
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">证件号：</label>
            <div class="col-sm-5">
                <input type="text" class="form-control" id="lodgingId" name="lodgingId">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">电话：</label>
            <div class="col-sm-5">
                <input type="text" class="form-control" id="lodgingPhone" name="lodgingPhone">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">房间号：</label>
            <div class="col-sm-5">
                <input type="text" class="form-control" id="lodgingRoomno" name="lodgingRoomno">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">开始时间：</label>
            <div class="col-sm-5">
                <input type="text" class="form-control" id="lodgingStart" name="lodgingStart">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">结束时间：</label>
            <div class="col-sm-5">
                <input type="text" class="form-control" id="lodgingEnd" name="lodgingEnd">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">支付金额：</label>
            <div class="col-sm-5">
                <input type="text" class="form-control" id="lodgingPrice" name="lodgingPrice">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">备注：</label>
            <div class="col-sm-5">
                <textarea rows="3" class="form-control" id="lodgingText" name="lodgingText" placeholder="请输入内容......"></textarea>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label"></label>
            <div class="col-sm-5">
                <input type="submit" class="btn btn-pill btn-grad btn-warning btn-sm" value="保存">
                <input type="button" class="btn btn-pill btn-grad btn-warning btn-sm" value="返回" onclick="javascript:history.back(-1);">
            </div>
        </div>
    </form>
</div>
</body>
<script type="text/javascript">
    //提交之前进行检查，如果return false，则不允许提交
    function check() {
        //根据ID获取值
        if (document.getElementById("lodgingName").value.trim().length == 0) {
            alert("姓名不能为空!");
            return false;
        }
        if (document.getElementById("lodgingId").value.trim().length == 0) {
            alert("证件号不能为空!");
            return false;
        }
        if (document.getElementById("lodgingPhone").value.trim().length == 0) {
            alert("电话不能为空!");
            return false;
        }
        if (document.getElementById("lodgingRoomno").value.trim().length == 0) {
            alert("房间号不能为空!");
            return false;
        }
        if (document.getElementById("lodgingStart").value.trim().length == 0) {
            alert("开始时间不能为空!");
            return false;
        }
        if (document.getElementById("lodgingEnd").value.trim().length == 0) {
            alert("结束时间不能为空!");
            return false;
        }
        if (document.getElementById("lodgingPrice").value.trim().length == 0) {
            alert("支付金额不能为空!");
            return false;
        }
        return true;
    }
</script>
</html>
